package com.uphone.edwards.pro.activity.login.mine;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.google.gson.Gson;
import com.radish.baselibrary.Intent.IntentUtils;
import com.radish.baselibrary.utils.LogUtils;
import com.uphone.edwards.R;
import com.uphone.edwards.base.mvp.BaseMvpActivity;
import com.uphone.edwards.modle.MineBean;
import com.uphone.edwards.pro.activity.login.LoginActivity;
import com.uphone.edwards.view.PickerScrollView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MineActivity extends BaseMvpActivity<MinePresenter> implements MineContract.View {

    @BindView(R.id.tvLogOut)
    TextView tvLogOut;
    @BindView(R.id.tv_xiugaixinxi)
    TextView tvXiugaixinxi;
    @BindView(R.id.ll_mine)
    LinearLayout llMine;
    @BindView(R.id.tv_address_select)
    TextView tvAddressSelect;
    @BindView(R.id.et_username)
    EditText etUsername;
    @BindView(R.id.et_gonghao)
    EditText etGonghao;
    @BindView(R.id.et_zhicheng)
    EditText etZhicheng;
    @BindView(R.id.tv_save)
    TextView tvSave;
    @BindView(R.id.lv_address)
    ListView lvAddress;
    @BindView(R.id.ll_bianji)
    LinearLayout llBianji;
    @BindView(R.id.ll_return)
    LinearLayout llReturn;
    @BindView(R.id.rl_con_cancel)
    RelativeLayout rlConCancel;
    @BindView(R.id.ps_select_address)
    PickerScrollView psSelectAddress;
    @BindView(R.id.rl_select_address)
    RelativeLayout rlSelectAddress;

    private MinePresenter mPresenter;


    @Override
    protected void initInject() {

    }


    @Override
    protected void initBundle() {

    }

    @Override
    protected int initLayout() {
        return R.layout.activity_mine;
    }

    @Override
    protected void initView() {
        mPresenter = new MinePresenter();
        mPresenter.attachView(this);
        mPresenter.postMine();
    }

    @Override
    protected void initTitle() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initListener() {

    }

    @OnClick({R.id.tvLogOut, R.id.tv_xiugaixinxi, R.id.tv_save, R.id.ll_return})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tvLogOut:
                IntentUtils.getInstance()
                        .with(this, LoginActivity.class)
                        .start();
                break;
            case R.id.tv_xiugaixinxi:
                llBianji.setVisibility(View.VISIBLE);
                llMine.setVisibility(View.GONE);
                break;
            case R.id.tv_save:
                llBianji.setVisibility(View.GONE);
                llMine.setVisibility(View.VISIBLE);
                break;
            case R.id.ll_return:
                finish();
                break;
        }
    }

    @Override
    public void mineView(String responseBean, int status) {
        LogUtils.e(responseBean);
    }

    @Override
    public void downMineView(String responseBean, int status) {
        Gson gson = new Gson();
        MineBean bean = gson.fromJson(responseBean, MineBean.class);
        if (0 == bean.getCode()) {

        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
